package com.mobile.collect.activitys;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.mobile.collect.R;
import com.mobile.collect.present.BasePresent;
import com.mobile.collect.utils.AppContents;

import butterknife.BindView;
import butterknife.OnClick;
import cn.droidlover.xdroidmvp.cache.SharedPref;
import cn.droidlover.xdroidmvp.kit.Kits;
import cn.droidlover.xdroidmvp.mvp.XActivity;

public class SettingActivity extends XActivity<BasePresent> {

    @BindView(R.id.txt_version)
    TextView txtVersion;
    @Override
    public int getContentViewId() {
        return R.layout.activity_setting;
    }

    @Override
    public void getIntentData() {

    }

    @Override
    public BasePresent newP() {
        return new BasePresent();
    }

    @Override
    public void getDataFromServer() {

    }

    @Override
    public void initView() {
        super.initView();
        titleTv.setText("设置");
        txtVersion.setText("当前版本：" + Kits.Package.getVersionName(this));
    }
    @Override
    public boolean isNotWorkConnect() {
        return false;
    }

    @OnClick({R.id.btn_export, R.id.btn_upload, R.id.btn_quit, R.id.qunxianLayout, R.id.beifenLayout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_export:
                startActivity(new Intent(this, ExportListActivity.class));
                break;
            case R.id.btn_quit:
                startActivity(new Intent(this, LoginActivity.class));
                break;
            case R.id.qunxianLayout:
                QuanxianEditActivity.lunch(this);
                break;
            case R.id.beifenLayout:
                startActivity(new Intent(this,BackUpActivity.class));
                break;
            case R.id.btn_upload:
                String userName = SharedPref.getInstance(this).getString(AppContents.LOGINNAME, "");
                if (TextUtils.isEmpty(userName)) {
                    LoginActivity.lunch(this);
                    break;
                } else {
                    startActivity(new Intent(this, UploadListActivity.class));
                }
                break;
        }
    }
}
